MyDesktop.RepairWindow = Ext.extend(Ext.app.Module, {
    id:'repair-win',
    init : function(){
        this.launcher = {
            text: '维修信息',
            iconCls:'icon-grid',
            handler : this.createWindow,
            scope: this
        }
    },

	record : Ext.data.Record.create([
        	{name : 'docID',mapping : 'docID',type : 'string'}, 
        	{name : 'pid',mapping : 'fid',type : 'int'}, 
        	{name : 'buyer',mapping : 'buyer',type : 'string'}, 
        	{name : 'unit',mapping : 'unit',type : 'string'}, 
        	{name : 'mobile',mapping : 'mobile',type : 'string'}, 
        	{name : 'phone',mapping : 'phone',type : 'string'}, 
        	{name : 'address',mapping : 'address',type : 'string'}, 
        	{name : 'csum',mapping : 'csum',type : 'float'},  
        	{name : 'loanid',mapping : 'loanid',type : 'int'}, 
        	{name : 'loanname',mapping : 'loanname',type : 'string'},  
        	{name : 'rate',mapping : 'rate',type : 'float'}, 
        	{name : 'interest',mapping : 'interest',type : 'float'},
        	{name : 'charge',mapping : 'charge',type : 'float'},
        	{name : 'debtorid',mapping : 'debtorid',type : 'int'},
        	{name : 'debtorname',mapping : 'debtorname',type : 'string'},
        	{name : 'startdate',mapping : 'startdate',type : 'date'},
        	{name : 'closedate',mapping : 'closedate',type : 'date'},
        	{name : 'accountid',mapping : 'accountid',type : 'int'},
        	{name : 'accountname',mapping : 'accountname',type : 'string'},
        	{name : 'status',mapping : 'status',type : 'string'},
			{name : 'createMan',mapping : 'createMan',type : 'string'},
        	{name : 'createtime',mapping : 'createtime',type : 'string'},
        	{name : 'memo',mapping : 'memo',type : 'string'}
	]),
	
	cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), 
         new Ext.grid.CheckboxSelectionModel({singleSelect : false}),
         {header : '业务单据',width : 120,dataIndex : 'docID'},
		 {header : '业务单位',width : 120,dataIndex : 'unit'},
		 {header : '用户姓名',width : 120,dataIndex : 'buyer'},
		 {header : '手机',width : 90,dataIndex : 'mobile'},
		 {header : '联系电话',width : 80,dataIndex : 'phone'},
		 {header : '用户地址',width : 90,dataIndex : 'address'},
		 {header : '报修日期',width : 90,dataIndex : 'closedate',sortable:true},
		 {header : '送货日期',width : 90,dataIndex : 'closedate',sortable:true},
		 {header : '维修日期',width : 80,dataIndex : 'csum',sortable : false},
		 {header : '级别',width : 60,dataIndex : 'rate',sortable : true},
		 {header : '状态',width : 60,dataIndex : 'status',sortable : true},
		 {header : '录入人员',width : 60,dataIndex : 'createMan'}
	]),
	
    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('repair-win');
		
        if(!win){
		
		var store=new Ext.data.Store({
        	url : app.url+'/admin/repair/findList.do',
			baseParams:{start:0,limit:20},
			autoLoad : true,
        	reader : new Ext.data.JsonReader({totalProperty : 'totalProperty',root : 'root'}, 
        	this.record)
        });
		
		var ds_debit_data = new Ext.data.Store({
        	url : app.url+'/admin/repair/repairInfo.do',
        	reader : new Ext.data.JsonReader({root : 'root'}, 
            this.record)
        });
		
		
		
    var tb = new Ext.Toolbar({
        height: 35,
		region: 'north',
        items: [{
            xtype:'buttongroup',
            items: [{
                text: '新增',
                iconCls: 'add',
                scale: 'small',
				handler: function(){
				     addRepair_win.show();
				}
            },{
                text: '拉修',
                iconCls: 'add16',
				iconCls: 'car',
                scale: 'small',
				handler : function(){
				   sendInstall_win.show();
				}
            },{
                text: '派工',
                iconCls: 'fix-go',
                scale: 'small',
				handler : function(){
				      showfixInstall();
				}
            }]
        }]
     });
		
	   var grid_debit = new Ext.grid.EditorGridPanel({
        	title : '维修列表',
        	iconCls : 'icon-grid',
        	collapsible: false,
			border:false,
            region: 'center',
            margins: '5 0 0 0',
			columnLines :true,
			autoScroll : true,
			width : 600,
        	viewConfig:
        	{
        	 forceFit:false,
        	 scrollOffset:15
        	 },	   	   
        	autoWidth : true,
        	region : 'center',
        	cm : this.cm,
        	ds : store,
        	sm : new Ext.grid.CheckboxSelectionModel({singleSelect : false}),
        	enableColumnMove : false,
        	trackMouseOver : false,
        	frame : true,
        	clicksToEdit : 1,
        	bbar : new Ext.PagingToolbar({
        		pageSize: 20,
                store: store,
                displayInfo: true,
                 plugins: new Ext.ux.ProgressBarPager(),
        		items:[{   
                        text: '导出到Excel',   
                        tooltip: 'Excel'
                      }]
        	}),listeners : {
        		'click' : function(){
        			var row = this.getSelectionModel().getSelected();
					if(row){
            			tpl_install.overwrite(debit_Detail.body,ds_debit_data.data);
            			ds_debit_data.baseParams.tid = row.data.tid; 
            			ds_debit_data.load();
					}
        		}
        	}
        });	
		
		var debit_Detail = new Ext.Panel({
            title: '详细内容'
        });
		
		var debit_tabs=new Ext.TabPanel({
            activeTab:0,
            defaults:{autoHeight: true},
            frame:true,
    		collapsible: true,
    		region: 'south',
            height: 150,
            minSize: 75,
            maxSize: 250,
            items:[debit_Detail,{
            title: 'Tab 2',
            html: 'This is tab 2 content.'
            }]
        });
		
		var p_debit = {
            layout: 'border',
            bodyBorder: false,
            defaults: {
                split: true,
                animFloat: false,
                autoHide: false,
                useSplitTips: true,
        		margins: '5 0 0 0',
                cmargins: '5 5 0 0'
            },
            items: [grid_debit,debit_tabs]
        };

        var nav = new Ext.Panel({
                region: 'west',
                title: '',
                split: true,
                width: 200,
                minSize: 175,
                maxSize: 400,
                collapsible: true,
                margins: '0 0 0 5',
                layout: {
                    type: 'accordion',
                    animate: true
                },
                items: [{
                    title: '状态导航',
					iconCls : 'icon-nav',
                    border: false,
                    xtype : 'treepanel',
							border : false,
							rootVisible : false,
							autoScroll : true,
							loader : new Ext.tree.TreeLoader({
							dataUrl : app.res+'/desktop/model/repair/repair-nav.json'
							}),
							root : new Ext.tree.AsyncTreeNode(),
							listeners : {
								'click' : function(n) {
									try {
										var sn = this.selModel.selNode || {};
										if (n.leaf && n.id != sn.id) {
										    store.load({params : {start : 0,limit : 20,status:n.id}});
											//Ext.getCmp('content-panel').layout.setActiveItem(n.id.substring(0, n.id
											//		.indexOf('-'))
											//		+ '-panel');

											//if('ds_'+n.id.substring(0, n.id.indexOf('-')))
											//	eval('ds_'+n.id.substring(0, n.id.indexOf('-'))).load({params : {start : 0,limit : 20}});
											
										}
									} catch (e) {
									}
								}
							}
                }, {
                    title: '系统设置',
                    border: false,
                    iconCls: 'settings'
                }]
        });
        var vp = new Ext.Panel({
				region: 'center',
                deferredRender: false,
				layout : 'card',
				border : false,
                activeItem : 0,
				items : [p_debit]
			
        });
		
		var addForm=new Ext.FormPanel({
                		border : true,
						region: 'north',
                		labelAlign : 'right',
                		labelWidth : 60,
						frame : true,
						height: 190,
                		items : [{
									layout:'column',
									items:[{
        								columnWidth : .3,
        								layout : 'form',
        								items : [getPartnerCombo()]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [getRepairTypeCombo()]
								    },{
        								columnWidth : .3,
        								layout : 'form',
        								items : [getDistrictCombo()]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [getInvoicesTypeCombo()]
								    }]
							},{// 2 row
									layout:'column',
									items:[{
        								columnWidth : .18,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '姓名',name : 'buyer',anchor : '100%',enableKeyEvents : true,allowBlank : false}]
								    },{
        								columnWidth : .42,
        								layout : 'form',
										labelWidth : 40,
        								items : [{xtype : 'textfield',fieldLabel : '地址',name : 'address',anchor : '100%',allowBlank : false}]
								    },{
        								columnWidth : .2,
        								layout : 'form',
										labelWidth : 30,
        								items : [{xtype : 'textfield',fieldLabel : '手机',name : 'mobile',anchor : '100%',allowBlank : false}]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '联系电话',name : 'phone',anchor : '100%',enableKeyEvents : true}]
								    }]
							},{// 3 row
									layout:'column',
									items:[{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '投诉单号',name : 'requestcode',anchor : '100%',enableKeyEvents : true}]
								    },{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'datefield',fieldLabel : '购买日期',name : 'buyDate',anchor : '100%',format:'Y-m-d'}]
								    }]
							},{// 4 row
									layout:'column',
									items:[{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'datefield',fieldLabel : '报修日期',name : 'reportDate',anchor : '100%',allowBlank : false,format:'Y-m-d'},
										         {xtype : 'datefield',fieldLabel : '维修日期',name : 'repairDate',anchor : '100%',allowBlank : false,format:'Y-m-d'}]
								    },{
        								columnWidth : .75,
        								layout : 'form',
										
        								items : [{xtype : 'textarea',fieldLabel : '备注',name : 'remarks',anchor : '100%',height: 48}]
								    }]
							},{// 5 row
									layout:'column',
									items:[{
        								layout : 'form',
										columnWidth : 1,
        								items : [{xtype : 'textfield',fieldLabel : '业务单位',name : 'buyer',anchor : '100%'}]
								    }]
							}]
						});
	
						
	 var repairItemRecord= Ext.data.Record.create([
        	{name : 'typeCode'}, 
        	{name : 'amount'},
        	{name : 'inbarcode'},
        	{name : 'outbarcode'},
        	{name : 'bugDesc'},
			{name : 'serveType'}
    	]);
	
	var cm= new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(),
		 {header : '商品编号',width : 120,dataIndex : 'typeCode'},
		 {header : '数量',width : 90,dataIndex : 'amount',
		  editor: new Ext.form.TextField({
                    allowBlank: false
                })
		 },
		 {header : '内机条码',width : 120,dataIndex : 'inbarcode',
		  editor: new Ext.form.TextField({
                    allowBlank: true
                })
		  },
		 {header : '外机条码',width : 90,dataIndex : 'outbarcode',
		  editor: new Ext.form.TextField({
                    allowBlank: true
                })
		 },
		 {header: '故障现象',dataIndex: 'bugDesc',editor : getBugCombo()},
		 {header: '服务类型',dataIndex: 'serveType',editor : getServerTypeCombo(),renderer:Ext.util.Format.comboRenderer(getServerTypeCombo())}
		 

	]);	
	
	var store_instal_new= new Ext.data.ArrayStore({
        fields: [
           {name: 'typeCode',type:'string'},
           {name: 'name', type: 'string'},
           {name: 'amount', type: 'int'},
           {name: 'inbarcode', type: 'string'},
		   {name: 'outbarcode', type: 'string'},
		   {name: 'inbarcode', type: 'string'},
		   {name: 'serveType', type: 'int'}
        ]
    });
	
	var tb_install_add = new Ext.Toolbar({
        items: [{
        	 xtype: 'button',
             text: '增加',
			 iconCls: 'add',
			 handler : function(){
			  var r=new repairItemRecord({});
			  store_instal_new.add(r);
			 }
           
          },'-',{
        	 xtype: 'button',
             text: '删除',
			 iconCls: 'remove',
			 handler : function(){
			   var record = grid_item.getSelectionModel().getSelected();
		       if (record) {
			     store_instal_new.remove(record);
				 grid_item.getView().refresh();
			   }
			 }
           
          }]
     });
						
	 var grid_item = new Ext.grid.EditorGridPanel({
        	title : '维修条目',
        	iconCls : 'icon-grid',
        	collapsible: false,
			border:false,
            region: 'center',
            margins: '5 0 0 0',
			columnLines :true,
			autoScroll : true,
			width : 600,
			enableHdMenu : false,
        	viewConfig:
        	{
        	 forceFit:false,
        	 scrollOffset:15
        	 },	   	   
        	autoWidth : true,
        	region : 'center',
			clicksToEdit : 1,
			tbar : tb_install_add,
        	cm : cm,
			ds : store_instal_new,
        	sm : new Ext.grid.CheckboxSelectionModel({singleSelect : false}),
        	enableColumnMove : false,
        	trackMouseOver : false,
        	frame : true
        	
        });						
						
   var  addRepair_win = new Ext.Window({
		        title:'维修信息录入',
                layout:'border',
                width:850,
                height:530,
				modal:true,
				closable: true,
				constrain:true,
                closeAction:'hide',
                plain: true,
				items : [addForm,grid_item],
                buttonAlign : 'center',
                buttons: [{
                    text:'保存',
					handler: function(){
                    if(addForm.getForm().isValid()){
    	                addForm.getForm().submit({
    	                	waitTitle : '请稍候',
    	                    url: app.url + '/admin/fix/saveNew.do',
    	                    method :"post",	
    	                    waitMsg: '正在保存',
    	                    success: function(addForm, o){
    	                      // store.loadData(o.result);
    	                    }
    	                });
                    }
                  }
                },{
                    text: '取消',
                    handler: function(){
                        addRepair_win.hide();
                    }
                }]
     });

   
 var fix_cols = [
	         		{header: "工号", width: 60, dataIndex: 'empID'},
	         		{header: "姓名", width: 90,  dataIndex: 'name'},
	         		{header: "提成", width: 50,dataIndex: 'namePinyin'}
	         	];

	         	var send_cols = [ new Ext.grid.RowNumberer(),
	         	    		{header: "姓名", width: 90,  dataIndex: 'name'},
	         	    		{header: "提成", width: 50,dataIndex: 'namePinyin'}
	         	    	];
	         	var fix_store=new Ext.data.JsonStore({
	     	    	  url : app.url+'/admin/employeeList.do',
	     	 		  baseParams:{start:0,limit:20},
	     	 		  autoLoad : true,	
	     	  	      root:'root',
	     	  		  fields:[
	     				{name : 'empID',mapping : 'empID',type : 'string'}, 
	     				{name : 'name',mapping : 'name',type : 'string'}, 
	     				{name : 'namePinyin',mapping : 'namePinyin',type : 'string'}
	     	  		  ]
	       	    }); 

	             var firstGrid = new Ext.grid.GridPanel({
	                         	 ddGroup          : 'secondGridDDGroup',
	                             store            : fix_store,
	                             columns          : fix_cols,
	                         	 enableDragDrop   : true,
	                             stripeRows       : true,
	                             columnLines :true,
	                             enableHdMenu : false,
	                             title            : '安装工列表'
	             });

	             var secondGridStore = new Ext.data.JsonStore({
	             	fields:[
	         				{name : 'id',mapping : 'id',type : 'int'}, 
	         				{name : 'name',mapping : 'name',type : 'string'}, 
	         				{name : 'namePinyin',mapping : 'namePinyin',type : 'string'}
	         	  		  ]
	             });
	             var secondGrid = new Ext.grid.GridPanel({
	             	     ddGroup          : 'firstGridDDGroup',
	                     store            : secondGridStore,
	                     columns          : send_cols,
	             	     enableDragDrop   : true,
	                     stripeRows       : true,
	                     columnLines :true,
	                     enableHdMenu : false,
	                     title            : '派工信息'
	             });

	          
	          var displayPanel = new Ext.Panel({
		            title:'派工',
					iconCls: 'fix-go',
		        	layout:'hbox',
		        	defaults     : { flex : 1 }, //auto stretch
		    		layoutConfig : { align : 'stretch' },
		      		items: [secondGrid,firstGrid],
		      		bbar : [
		      			'->', 
		      			{
		      				text    : '重新选择',
                            iconCls: 'fix-reset',
		      				handler : function() {
		      				    fix_store.reload();
		      					secondGridStore.removeAll();
		      				}
		      			}
		      		]
	      	});
	var store=new Ext.data.JsonStore({
	      root:'item',
		  fields:[
		    {name : 'typeCode',mapping : 'typeCode',type : 'string'}, 
        	{name : 'amount',mapping : 'amount',type : 'string'}, 
        	{name : 'inbarcode',mapping : 'inbarcode',type : 'string'}, 
        	{name : 'outbarcode',mapping : 'outbarcode',type : 'string'}, 
			{name : 'bugDesc',mapping : 'bugDesc',type : 'string'}
		  ]
	    }); 		
	var column= new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(),
		 {header : '商品编号',width : 120,dataIndex : 'typeCode'},
		 {header : '数量',width : 90,dataIndex : 'amount'},
		 {header : '内机条码',width : 120,dataIndex : 'inbarcode'},
		 {header : '外机条码',width : 90,dataIndex : 'outbarcode'},
		 {header: '故障现象',dataIndex: 'bugDesc',editor:getBugCombo()}
	 ]);	
	 
	 var grid = new Ext.grid.GridPanel({
        	title : '维修条目',
        	iconCls : 'icon-grid',
        	collapsible: false,
			border:false,
            region: 'center',
            margins: '5 0 0 0',
			columnLines :true,
			autoScroll : true,
			width : 600,
			enableHdMenu : false,
        	viewConfig:
        	{
        	 forceFit:true,
        	 scrollOffset:15
        	 },	   	   
        	autoWidth : true,
        	region : 'center',
        	cm : cm,
			ds : store,
        	sm : new Ext.grid.CheckboxSelectionModel({singleSelect : false}),
        	enableColumnMove : false,
        	trackMouseOver : false,
        	frame : true
        	
        });	
			

	          var fix_tabs=new Ext.TabPanel({
	              activeTab:0,
	              frame:true,
	      		  collapsible: true,
	      		  region: 'center',
	              items:[displayPanel,grid]
	          });      	


	var fixForm=new Ext.FormPanel({
                		border : true,
						region: 'north',
                		labelAlign : 'right',
                		labelWidth : 60,
						frame : true,
						height: 190,
                		items : [{
									layout:'column',
									items:[{
        								columnWidth : .3,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '单据号',name : 'docID',anchor : '100%',disabled : true}]
								    }]
							},{
									layout:'column',
									items:[{
        								columnWidth : .3,
        								layout : 'form',
        								items : [getPartnerCombo()]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [getRepairTypeCombo()]
								    },{
        								columnWidth : .3,
        								layout : 'form',
        								items : [getDistrictCombo()]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [getInvoicesTypeCombo()]
								    }]
							},{// 2 row
									layout:'column',
									items:[{
        								columnWidth : .18,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '姓名',name : 'buyer',anchor : '100%',enableKeyEvents : true,allowBlank : false}]
								    },{
        								columnWidth : .42,
        								layout : 'form',
										labelWidth : 40,
        								items : [{xtype : 'textfield',fieldLabel : '地址',name : 'address',anchor : '100%',allowBlank : false}]
								    },{
        								columnWidth : .2,
        								layout : 'form',
										labelWidth : 30,
        								items : [{xtype : 'textfield',fieldLabel : '手机',name : 'mobile',anchor : '100%',allowBlank : false}]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '联系电话',name : 'phone',anchor : '100%',enableKeyEvents : true}]
								    }]
							},{// 3 row
									layout:'column',
									items:[{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '投诉单号',name : 'requestcode',anchor : '100%',enableKeyEvents : true}]
								    },{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'datefield',fieldLabel : '购买日期',name : 'buyDate',anchor : '100%',format:'Y-m-d'}]
								    }]
							},{// 4 row
									layout:'column',
									items:[{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'datefield',fieldLabel : '报修日期',name : 'reportDate',anchor : '100%',allowBlank : false,format:'Y-m-d'},
										         {xtype : 'datefield',fieldLabel : '维修日期',name : 'repairDate',anchor : '100%',allowBlank : false,format:'Y-m-d'}]
								    },{
        								columnWidth : .75,
        								layout : 'form',
										
        								items : [{xtype : 'textarea',fieldLabel : '备注',name : 'remarks',anchor : '100%',height: 48}]
								    }]
							},{// 5 row
									layout:'column',
									items:[{
        								layout : 'form',
										columnWidth : 1,
        								items : [{xtype : 'textfield',fieldLabel : '业务单位',name : 'buyer',anchor : '100%'}]
								    }]
							}]
						});  
			  
	      	
	    var fixRepair_win=new Ext.Window({
	     title:"维修派工",
	     layout:'border',
         width:850,
         height:530,
		 closable: true,
		 constrain:true,
         closeAction:'hide',
         items : [fixForm,fix_tabs],
         buttonAlign : 'center',
		 listeners : {
    		 'show' : function(e) {
			   
    			Ext.Ajax.request({
	                url :app.url+'/admin/repair/repairInfo.do',
	                params :{docID:'3000'},
	                method :"post",
	                callback :function(options,success,response){
	                     
	                },
	                success:function(response,options){				        
	                       var receive=Ext.decode(response.responseText);
						   fixForm.getForm().setValues(receive.root);
						   store.loadData(receive);
	                },
	                failure:function(response,options){
	                      Ext.MessageBox.alert("提示","数据加载异常");
	                }
	            });
    		 }
	    },
         buttons: [{
             text:'保存',
				handler: function(){
             if(fixForm.getForm().isValid()){
	               fixForm.getForm().submit({
	                	waitTitle : '请稍候',
	                    url: app.url + '/admin/fix/saveNew.do',
	                    method :"post",	
	                    waitMsg: '正在保存',
	                    success: function(fixForm, o){
	                      // store.loadData(o.result);
	                    }
	                });
             }
           }
         },{
             text: '取消',
             handler: function(){
                 fixRepair_win.hide();
             }
         }]
	  
	    });


		
	function showfixInstall(){
		
		fixRepair_win.show();
		
	    var firstGridDropTargetEl =  firstGrid.getView().scroller.dom;
        var firstGridDropTarget = new Ext.dd.DropTarget(firstGridDropTargetEl, {
                ddGroup    : 'firstGridDDGroup',
                notifyDrop : function(ddSource, e, data){
                        var records =  ddSource.dragData.selections;
                        Ext.each(records, ddSource.grid.store.remove, ddSource.grid.store);
                        firstGrid.store.add(records);
                        return true
                }
        });


        var secondGridDropTargetEl = secondGrid.getView().scroller.dom;
        var secondGridDropTarget = new Ext.dd.DropTarget(secondGridDropTargetEl, {
                ddGroup    : 'secondGridDDGroup',
                notifyDrop : function(ddSource, e, data){
                        var records =  ddSource.dragData.selections;
                        Ext.each(records, ddSource.grid.store.remove, ddSource.grid.store);
                        secondGrid.store.add(records);
                        return true
                }
        });
		
    }
	
	
	
	
	var sendForm=new Ext.FormPanel({
                		border : true,
						region: 'north',
                		labelAlign : 'right',
                		labelWidth : 60,
						frame : true,
						height: 190,
                		items : [{// 2 row
									layout:'column',
									items:[{
        								columnWidth : .18,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '姓名',name : 'buyer',anchor : '100%',disabled:true}]
								    },{
        								columnWidth : .42,
        								layout : 'form',
										labelWidth : 40,
        								items : [{xtype : 'textfield',fieldLabel : '地址',name : 'address',anchor : '100%'}]
								    },{
        								columnWidth : .2,
        								layout : 'form',
										labelWidth : 30,
        								items : [{xtype : 'textfield',fieldLabel : '手机',name : 'mobile',anchor : '100%'}]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '联系电话',name : 'phone',anchor : '100%'}]
								    }]
							},{// 3 row
									layout:'column',
									items:[{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'datefield',fieldLabel : '单据日期',name : 'invoicesDate',anchor : '100%',allowBlank : false,format:'Y-m-d'}]
								    },{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '批文号码',name : 'batchNum',anchor : '100%',enableKeyEvents : true}]
								    },{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'textfield',fieldLabel : '提单号码',name : 'pickNum',anchor : '100%',enableKeyEvents : true}]
								    },{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'datefield',fieldLabel : '购买日期',name : 'buyDate',anchor : '100%',format:'Y-m-d'}]
								    }]
							},{// 4 row
									layout:'column',
									items:[{
        								columnWidth : .25,
        								layout : 'form',
        								items : [{xtype : 'datefield',fieldLabel : '送货日期',name : 'deliverDate',anchor : '100%',allowBlank : false,format:'Y-m-d'},
										         {xtype : 'datefield',fieldLabel : '安装日期',name : 'fixDate',anchor : '100%',allowBlank : false,format:'Y-m-d'}]
								    },{
        								columnWidth : .75,
        								layout : 'form',
										
        								items : [{xtype : 'textarea',fieldLabel : '备注',name : 'remarks',anchor : '100%',height: 48}]
								    }]
							},{// 5 row
									layout:'column',
									items:[{
        								layout : 'form',
										columnWidth : 1,
        								items : [{xtype : 'textfield',fieldLabel : '业务单位',name : 'buyer',anchor : '100%'}]
								    }]
							},{//6
									layout:'column',
									items:[{
        								columnWidth : .2,
        								layout : 'form',
        								items : [getDriverCombo()]
								    },{
        								columnWidth : .2,
        								layout : 'form',
        								items : [getCarCombo()]
								    }]
							}]
						});
						
   var install_item = new Ext.grid.EditorGridPanel({
        	title : '维修条目',
        	iconCls : 'icon-grid',
        	collapsible: false,
			border:false,
            region: 'center',
            margins: '5 0 0 0',
			columnLines :true,
			autoScroll : true,
			width : 600,
			enableHdMenu : false,
        	viewConfig:
        	{
        	 forceFit:true,
        	 scrollOffset:15
        	 },	   	   
        	autoWidth : true,
        	region : 'center',
        	cm : cm,
			ds : store_instal_new,
        	sm : new Ext.grid.CheckboxSelectionModel({singleSelect : false}),
        	enableColumnMove : false,
        	trackMouseOver : false,
        	frame : true
        	
        });							
	
	var  sendInstall_win = new Ext.Window({
		        title:'维修拉修',
                layout:'border',
                width:850,
                height:530,
				modal:true,
				closable: true,
				constrain:true,
                closeAction:'hide',
                plain: true,
				items : [sendForm,install_item],
                buttonAlign : 'center',
                buttons: [{
                    text:'保存',
					handler: function(){
                    if(sendForm.getForm().isValid()){
    	                sendForm.getForm().submit({
    	                	waitTitle : '请稍候',
    	                    url: app.url + '/admin/fix/saveNew.do',
    	                    method :"post",	
    	                    waitMsg: '正在保存',
    	                    success: function(sendForm, o){
    	                      // store.loadData(o.result);
    	                    }
    	                });
                    }
                  }
                },{
                    text: '取消',
                    handler: function(){
                        addRepair_win.hide();
                    }
                }]
     });


            win = desktop.createWindow({
                id: 'repair-win',
                title:'维修信息',
                width:app.maxWidth,
                height:app.maxHeight,
                iconCls: 'icon-grid',
                shim:false,
                animCollapse:false,
                constrainHeader:true,
                layout: 'border',
                items:[tb,nav,vp]
                    
            });
        }
        win.show();
    }
});